<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Claude Code 本地部署指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        .code-block {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 8px;
            padding: 1.5rem;
            overflow-x: auto;
            position: relative;
        }
        .code-block::before {
            content: 'SHELL';
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            font-size: 0.75rem;
            color: #6b7280;
            font-weight: 500;
        }
        .step-number {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            width: 3rem;
            height: 3rem;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 1.25rem;
            flex-shrink: 0;
        }
        .api-card {
            background: white;
            border-radius: 16px;
            padding: 2rem;
            box-shadow: 0 10px 30px rgba(0,0,0,0.05);
            border: 1px solid #e5e7eb;
            transition: all 0.3s ease;
        }
        .api-card:hover {
            border-color: #667eea;
            box-shadow: 0 15px 40px rgba(102, 126, 234, 0.1);
        }
        .highlight-text {
            background: linear-gradient(120deg, #ffd700 0%, #ffed4e 100%);
            padding: 0.125rem 0.5rem;
            border-radius: 4px;
            font-weight: 500;
        }
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .fade-in {
            animation: fadeIn 0.6s ease-out;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <div class="hero-gradient text-white">
        <div class="container mx-auto px-6 py-20">
            <div class="max-w-4xl mx-auto text-center fade-in">
                <h1 class="text-5xl md:text-6xl font-bold mb-6" style="font-family: 'Noto Serif SC', serif;">
                    Claude Code 本地部署指南
                </h1>
                <p class="text-xl md:text-2xl mb-8 opacity-90">
                    使用国产大模型，打造您的 AI 编程助手
                </p>
                <div class="flex justify-center space-x-6 text-sm">
                    <div class="flex items-center">
                        <i class="fas fa-clock mr-2"></i>
                        <span>15分钟快速部署</span>
                    </div>
                    <div class="flex items-center">
                        <i class="fas fa-shield-alt mr-2"></i>
                        <span>数据安全可控</span>
                    </div>
                    <div class="flex items-center">
                        <i class="fas fa-coins mr-2"></i>
                        <span>成本更低廉</span>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Introduction -->
    <div class="container mx-auto px-6 py-16">
        <div class="max-w-4xl mx-auto">
            <div class="bg-white rounded-2xl shadow-xl p-8 md:p-12 fade-in">
                <div class="flex items-start mb-6">
                    <i class="fas fa-info-circle text-3xl text-purple-600 mr-4 mt-1"></i>
                    <div>
                        <h2 class="text-2xl font-bold mb-4">什么是 Claude Code？</h2>
                        <p class="text-gray-700 leading-relaxed mb-4">
                            Claude Code 是一个基于 Anthropic Claude 模型的代码编辑工具，类似于 Cursor 或 VS Code 的 AI 扩展。它允许开发者使用 AI 辅助编写代码，提供智能代码补全、重构建议和问题解答等功能。
                        </p>
                        <p class="text-gray-700 leading-relaxed">
                            本教程将指导您如何在本地安装并配置 Claude Code，使用国产大模型（如 <span class="highlight-text">Deepseek</span>、<span class="highlight-text">智谱 GLM 4.5</span> 或 <span class="highlight-text">Kimi/Moonshot</span>）作为后端 API，从而避免依赖国外服务，实现数据安全可控。
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Architecture Diagram -->
    <div class="container mx-auto px-6 py-8">
        <div class="max-w-6xl mx-auto">
            <h2 class="text-3xl font-bold text-center mb-8">系统架构概览</h2>
            <div class="bg-white rounded-2xl shadow-xl p-8">
                <div class="mermaid">
                    graph LR
                        A[开发者] -->|输入代码请求| B[Claude Code CLI]
                        B -->|API 调用| C{国产大模型}
                        C --> D[Deepseek]
                        C --> E[智谱 GLM]
                        C --> F[Kimi/Moonshot]
                        D -->|返回代码建议| B
                        E -->|返回代码建议| B
                        F -->|返回代码建议| B
                        B -->|展示结果| A
                        
                        style A fill:#f9f,stroke:#333,stroke-width:2px
                        style B fill:#bbf,stroke:#333,stroke-width:2px
                        style C fill:#fbf,stroke:#333,stroke-width:2px
                        style D fill:#bfb,stroke:#333,stroke-width:2px
                        style E fill:#bfb,stroke:#333,stroke-width:2px
                        style F fill:#bfb,stroke:#333,stroke-width:2px
                </div>
            </div>
        </div>
    </div>

    <!-- Steps -->
    <div class="container mx-auto px-6 py-16">
        <div class="max-w-5xl mx-auto">
            <!-- Step 1 -->
            <div class="mb-16 fade-in">
                <div class="flex items-start mb-8">
                    <div class="step-number">1</div>
                    <h2 class="text-3xl font-bold ml-6 mt-2">安装 Node.js 18+ 版本</h2>
                </div>
                
                <div class="bg-white rounded-2xl shadow-xl p-8 md:p-10">
                    <p class="text-gray-700 mb-6">Claude Code 依赖 Node.js 运行。首先，确保您的电脑安装了 Node.js 18 或更高版本。</p>
                    
                    <div class="space-y-6">
                        <div class="flex items-start">
                            <i class="fas fa-download text-purple-600 mt-1 mr-4"></i>
                            <div class="flex-1">
                                <h3 class="font-bold mb-2">下载和安装 Node.js</h3>
                                <ul class="text-gray-700 space-y-2">
                                    <li>• 访问官网：<a href="https://nodejs.org" class="text-purple-600 hover:underline">https://nodejs.org</a></li>
                                    <li>• 下载 LTS（长期支持）版本（推荐 18.x 或更高）</li>
                                    <li>• 根据您的操作系统安装，选择默认选项即可</li>
                                    <li>• 安装完成后，重启终端以确保环境变量生效</li>
                                </ul>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <i class="fas fa-check-circle text-green-600 mt-1 mr-4"></i>
                            <div class="flex-1">
                                <h3 class="font-bold mb-2">验证安装</h3>
                                <p class="text-gray-700 mb-3">在终端输入以下命令并按回车：</p>
                                <div class="code-block">
                                    <code>node -v</code>
                                </div>
                                <p class="text-gray-600 mt-3 text-sm">如果显示版本号（如 v18.x.x），则安装成功。</p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <i class="fas fa-terminal text-blue-600 mt-1 mr-4"></i>
                            <div class="flex-1">
                                <h3 class="font-bold mb-2">安装 Claude Code 包</h3>
                                <p class="text-gray-700 mb-3">在终端输入以下命令（-g 参数表示全局安装）：</p>
                                <div class="code-block">
                                    <code>npm install -g @anthropic-ai/claude-code</code>
                                </div>
                                <div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 mt-4">
                                    <p class="text-sm text-yellow-800">
                                        <i class="fas fa-exclamation-triangle mr-2"></i>
                                        如遇权限问题，macOS/Linux 用户可添加 <code class="bg-yellow-100 px-1 rounded">sudo</code> 前缀
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Step 2 -->
            <div class="mb-16 fade-in">
                <div class="flex items-start mb-8">
                    <div class="step-number">2</div>
                    <h2 class="text-3xl font-bold ml-6 mt-2">设置国产大模型 API</h2>
                </div>
                
                <div class="bg-white rounded-2xl shadow-xl p-8 md:p-10">
                    <p class="text-gray-700 mb-8">Claude Code 默认使用 Anthropic 的 API，但我们可以通过环境变量重定向到国产大模型的兼容接口。选择以下任一模型进行配置：</p>
                    
                    <!-- Model Cards -->
                    <div class="grid md:grid-cols-3 gap-6">
                        <!-- Deepseek Card -->
                        <div class="api-card card-hover">
                            <div class="flex items-center mb-4">
                                <i class="fas fa-robot text-3xl text-indigo-600 mr-3"></i>
                                <h3 class="text-xl font-bold">Deepseek</h3>
                            </div>
                            <p class="text-gray-600 mb-4 text-sm">高效的国产大模型，专注代码生成</p>
                            <div class="space-y-3">
                                <div>
                                    <p class="text-xs text-gray-500 mb-1">获取 API Key</p>
                                    <a href="https://platform.deepseek.com/api_keys" class="text-indigo-600 text-sm hover:underline break-all">platform.deepseek.com/api_keys</a>
                                </div>
                                <div>
                                    <p class="text-xs text-gray-500 mb-1">环境变量配置</p>
                                    <div class="code-block text-xs">
                                        <code>export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic<br>
export ANTHROPIC_AUTH_TOKEN="您的API Key"<br>
export ANTHROPIC_MODEL=deepseek-chat</code>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- GLM Card -->
                        <div class="api-card card-hover">
                            <div class="flex items-center mb-4">
                                <i class="fas fa-brain text-3xl text-purple-600 mr-3"></i>
                                <h3 class="text-xl font-bold">智谱 GLM 4.5</h3>
                            </div>
                            <p class="text-gray-600 mb-4 text-sm">强大的多模态模型，适合复杂任务</p>
                            <div class="space-y-3">
                                <div>
                                    <p class="text-xs text-gray-500 mb-1">获取 API Key</p>
                